﻿

	/**
	 * 添加操作信息的链接
	 */
	function showOperate(value, metadata, record) {	
		var recordEmpId=record.get("Emp_idColumn"); 
		var dealDate=record.get("bizDateColumn"); 
		var state=record.get("HolidayBill_stateColumn"); 
		var holidayId=record.get("holidayIdColumn"); 
		var empId=document.getElementById('listForm:txtEmpId').value;	
		var isClose=record.get("isCloseColumn"); 
		if(isClose==null||isClose=='')
		{
		  isClose=false;
		}	
		if(isClose=='false')
		{
			if(isStringNotEmpty(recordEmpId)&&isStringNotEmpty(empId)){
				if(recordEmpId==empId)
				{
					if(state==null||state==''){
						return '<a href="javascript:forwardShowHolidayBill(\''+empId+'\',\''+dealDate+'\')" > 处理</a>';	
					}else{
						return '<a href="javascript:viewHolidayBill(\''+holidayId+'\')" > 查看</a>';	
					}			
				}else{
					if(isStringNotEmpty(state)){
						return '<a href="javascript:viewHolidayBill(\''+holidayId+'\')" > 查看</a>';	
					}			
				}		
			}	
		}else
		{
			if(isStringNotEmpty(state)){
				return '<a href="javascript:viewHolidayBill(\''+holidayId+'\')" > 查看</a>';	
			}		   
		}		
		return "";
	}	
	
	function forwardShowHolidayBill(empId,dealDate) 
	{
	  KDWin.open('../../../aoyuan/aytime/bizbill/holidayBillEditUI.jsf?operateState=ADDNEW&fromBill=attenDetail&dealDate='+dealDate, {name:'editBill_HolidayBillEditUIBean',title:'',X:800,Y:600,scroll:'off',resizable:'yes',Maximize:'no',Minimize:'no'});
	}
	
	function viewHolidayBill(billId) 
	{
	  KDWin.open('../../../aoyuan/aytime/bizbill/holidayBillEditUI.jsf?operateState=VIEW&fromBill=attenDetail&billId='+encodeId(billId), {name:'editBill_HolidayBillEditUI11Bean',title:'',X:800,Y:600,scroll:'off',resizable:'yes',Maximize:'no',Minimize:'no'});
	}
	
	function isStringNotEmpty(valueObj)
	{
		if(valueObj!=null&&valueObj!=""){
		   return true;
		}else
		{
		   return false;
		}
	}
	
	function stateRenderer(value, metadata, record,rowIndex,colIndex) {
		if(value=='0')
		{
			return '草拟';
		}else if (value=='1')
		{
			return '申请中';
		}else if(value=='3')
		{
			return '审批通过';
		}else if(value=='4')
		{
			return '审批不通过';
		}
	   return "";
	}	
	
	function isCloseRenderer(value, metadata, record,rowIndex,colIndex) {
		if(value=='true')
		{
			return '是';
		}else if (value=='false')
		{
			return '否';
		}
	   return "否";
	}
	
	/**
	*用于转化ID 含有加好
	*/
	function encodeId(objId)
	{
		if(objId==null||objId==""){
			return objId;
		}else{
		 return objId.replace(/\+/g,'%2B');
		}
	}